package leetcode.f1t100;

/**
 * 爬楼梯, 一次只能走1到2阶, 输出n阶楼梯共有多少种方法
 * https://leetcode.com/problems/climbing-stairs/
 * @Author lichongxiao
 * @Date 2022/11/23 16:20
 */
public class Q70_ClimbingStairs {
    public int climbStairs(int n) {
        int n1 = 0, n2 = 1;
        for (int i = 0; i < n; i++) {
            n1 += n2;
            n2 += n1;
            n1 = n2 - n1;
            n2 -= n1;
        }
        return n2;
    }


    public static void main(String[] args) {
        Q70_ClimbingStairs bean = new Q70_ClimbingStairs();
        bean.climbStairs(44);
    }
}
